package gat.common.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author 热心村民王富贵
 * @date 2022/6/20
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum MsgStatusEnums {

    UNREAD(0, "未读"),
    READ(1, "已读"),

    ;

    private Integer code;

    private String desc;

    @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
    public static MsgStatusEnums getByCode(@JsonProperty("code") Integer code) {
        for (MsgStatusEnums value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
}
